import {Sequelize, Model} from "sequelize";
import sequelize from "../libs/db";

class Sentence extends Model {

}

Sentence.init(
 {
	id: {
		type: Sequelize.INTEGER,
			primaryKey: true,
			autoIncrement: true,
	},
	image: {
		type: Sequelize.STRING(64)
	},
	content: {
		type: Sequelize.STRING(300),
			allowNull: true
	},
	url: {
		type: Sequelize.STRING(100),
			allowNull: true
	},
	pubdate: {
		type: Sequelize.DATE,
			allowNull: true
	},
	fav_nums: {
		type: Sequelize.INTEGER,
			defaultValue: 0,
	},
	type: {
		type: Sequelize.INTEGER,
	},
	title: {
		type: Sequelize.STRING(50),
	},
	status: {
		type: Sequelize.INTEGER,
	}
},
 {
	tableName: 'sentence',
		modelName: 'sentence',
		paranoid: true,
		underscored: true,
		timestamps: true,
		createAt: 'created_at',
		updateAt: 'updated_at',
		deletedAt: 'deleted_at',
		sequelize
}
)

export {Sentence as SentenceModel}
